/**
 * Created by joustany on 17/11/13.
 */
$(function () {
    patOne()
})
// console.log($('.photo'))
//调用微信相机上传微信服务器
function take_a_photo(){
    wx.chooseImage({
        count: 1, // 默认9，这里每次只处理一张照片
        sizeType: ['original', 'compressed'],
        sourceType: ['camera'],
        success: function (res) {
            $('.photo')[0].src = res.localIds;
            console.log(res.localIds)
            wx.uploadImage({
                localId: res.localIds.toString(), // 需要上传的图片的本地ID，由chooseImage接口获得
                success: function (res) {
                    images.serverId = res.serverId; // 返回图片的服务器端ID
                    if(!$('.photo')[0].src == ''){
                        $('.pat img')[0].src = './icon导出/重拍icon.png'
                    }
                }
            });

        }
    });
}
$('.pat img').click(function () {
    take_a_photo()
})
function seveHandle() {
    document.cookie="patOne=;max-age=0;expires=Thu, 01 Jan 1970 00:00:00 GMT"
    // console.log($('.photo').attr('src'))
    // var  files = $('.photo').attr('src')
    // $.ajax({
    //     url:url,
    //     data:files,
    //     type:"post",
    //     success:function (data) {
    //         "use strict"
    //
    //     }
    // })
}
